#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;

const int N = 12;
int arr[N][N];
int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
int pos = 0;
int main()
{
	int n; cin >> n;
	int x = 1, y = 1;
	int count = 1;
	
	while (count <= n * n)
	{
		arr[x][y] = count;

		int a = x + dx[pos];
		int b = y + dy[pos];
		if (a > n || a < 1 || b<1 || b>n || arr[a][b] != 0)
		{
			pos = (pos + 1) % 4;
			a = x + dx[pos];
			b = y + dy[pos];
		}
		x = a;
		y = b;
		count++;
	}

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= n; j++)
		{
			printf("%3d", arr[i][j]);
		}
		cout << endl;
	}

	return 0;
}